package org.ehe.finance.voucher.domain.bo;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.ehe.finance.voucher.domain.ErpFinanceVoucherDetail;

import java.time.LocalDate;
import java.util.List;

/**
 * 凭证创建Bo
 * @author :zhangnn
 * @className :VoucherCreateBo
 * @description: TODO
 * @date 2025-08-25 09:31:51
 */
@Data
public class VoucherCreateBo {
    @Schema(description = "凭证类别ID")
    @NotNull(message = "凭证类别不能为空")
    private Long voucherTypeId;



    @Schema(description = "凭证日期")
    @NotNull(message = "凭证日期不能为空")
    private LocalDate voucherDate;

    @Schema(description = "会计期间:YYYY-MM")
    @NotBlank(message = "会计期间不能为空")
    @Pattern(regexp = "^\\d{4}-\\d{2}$", message = "会计期间格式必须为YYYY-MM")
    private String period;

    @Schema(description = "附件张数")
    @Min(value = 0, message = "附件张数不能小于0")
    private Integer attachmentCount = 0;

    @Schema(description = "摘要")
    @Size(max = 255, message = "摘要长度不能超过255个字符")
    private String abstractInfo;

    @Schema(description = "来源类型:1手工录入,2系统生成")
    @NotNull(message = "来源类型不能为空")
    @Min(value = 1, message = "来源类型值不正确")
    @Max(value = 2, message = "来源类型值不正确")
    private Integer sourceType = 1;

    @Schema(description = "来源单据ID")
    private Long sourceId;

    @Schema(description = "来源单据号")
    @Size(max = 50, message = "来源单据号长度不能超过50个字符")
    private String sourceNo;

    /**
     * 分录明细
     */
    private List<VoucherDetailCreateBo> detailCreateBoList;
}
